package com.ad.pet.app.account.adapter;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ad.pet.R;
import com.ad.pet.models.remote.account.AccountItem;

import java.util.List;

/**
 * Created by SEELE on 2018/6/14.
 */

public class AccountAdapter extends BaseQuickAdapter<AccountItem, BaseViewHolder> {


    public AccountAdapter(@Nullable List<AccountItem> data) {
        super(R.layout.item_account_center_list_layout, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, AccountItem item) {
        ImageView ivLogo = helper.getView(R.id.iv_logo);
        TextView tvTitlte = helper.getView(R.id.tv_title);
        ImageView ivRight = helper.getView(R.id.iv_right);
        if (item.getDrawableRight()!=0){
            ivRight.setImageResource(item.getDrawableRight());
        }
        ivLogo.setImageResource(item.getItemType());
        tvTitlte.setText(item.getTitle());
        helper.getView(R.id.view_line).setVisibility(helper.getLayoutPosition() == mData.size() - 1 ? View.GONE : View.VISIBLE);

    }
}
